package com.aspose.cells;

class zbc {
   static long a = (long)Math.pow(2.0D, 48.0D) - 1L;
   static double[] b = new double[]{1.0D, 0.1D, 0.01D, 0.001D, 1.0E-4D, 1.0E-5D, 1.0E-6D, 1.0E-7D, 1.0E-8D, 1.0E-9D, 1.0E-10D, 1.0E-11D, 1.0E-12D, 1.0E-13D, 1.0E-14D, 1.0E-15D, 1.0E-16D, 1.0E-17D, 1.0E-18D, 1.0E-19D, 1.0E-20D, 1.0E-21D, 1.0E-22D, 1.0E-23D, 1.0E-24D, 1.0E-25D, 1.0E-26D, 1.0E-27D, 1.0E-28D, 1.0E-29D, 1.0E-30D};

   static double a(double var0) {
      int var2 = (int)Math.log10(Math.abs(var0));
      int var3 = 14 - var2;
      return var3 >= 0 && var3 <= 15 ? com.aspose.cells.b.a.zq.b(var0, var3) : var0;
   }

   static boolean a(double var0, double var2) {
      double var4 = Math.abs(var0 - var2);
      if (var4 < Double.MIN_VALUE) {
         return true;
      } else {
         if (var4 < 1.0E-4D) {
            int var6 = (int)Math.log10(Math.abs(var0));
            int var7 = 14 - var6;
            if (var7 >= 0) {
               if (var7 >= b.length) {
                  return var4 < Math.pow(10.0D, (double)(-var7));
               }

               return var4 < b[var7];
            }
         }

         return var0 == var2;
      }
   }

   static Object b(double var0, double var2) {
      return var0 >= 0.0D && var2 >= 0.0D && (double)((int)var0) == var0 && (double)((int)var2) == var2 && var0 <= (double)a && var2 <= (double)a ? (double)((int)var0 & (int)var2) : zst.f;
   }

   static Object c(double var0, double var2) {
      return (double)((int)var0) == var0 && (double)((int)var2) == var2 && var0 <= (double)a && var2 <= (double)a ? (double)((int)var0 | (int)var2) : zst.f;
   }

   static Object d(double var0, double var2) {
      return (double)((int)var0 ^ (int)var2);
   }

   static Object e(double var0, double var2) {
      return (double)((int)var0 << (int)var2);
   }

   static Object f(double var0, double var2) {
      return (double)((int)var0 >> (int)var2);
   }

   static Object a(Object var0, WorkbookSettings var1) {
      var0 = zyn.a(var0, var1);
      return var0 instanceof zst ? var0 : Math.abs((Double)var0);
   }

   static Object b(Object var0, WorkbookSettings var1) {
      if (var0 == null) {
         return true;
      } else if (var0 instanceof zst) {
         return var0;
      } else {
         double var2;
         switch(zamo.a(var0.getClass())) {
         case 3:
            return !(Boolean)var0;
         case 14:
            var2 = (Double)var0;
            return var2 == 0.0D;
         case 16:
            var2 = CellsHelper.getDoubleFromDateTime((DateTime)var0, var1.getDate1904());
            return var2 == 0.0D;
         case 18:
            return zst.i;
         default:
            return zst.i;
         }
      }
   }

   public static double g(double var0, double var2) {
      if (var2 < 0.0D) {
         return 1.0D / g(var0, -var2);
      } else {
         int var4 = (int)var2;
         return var2 != (double)var4 ? Math.pow(var0, var2) : a(var0, var4);
      }
   }

   public static double a(double var0, int var2) {
      if (var0 == 0.0D) {
         return 0.0D;
      } else if (var2 == 0) {
         return 1.0D;
      } else {
         double var3;
         int var6;
         for(var3 = 1.0D; var2 != 0; var2 = var6) {
            int var5 = var2 % 2;
            var6 = var2 / 2;
            if (var5 != 0) {
               var3 *= var0;
            }

            var0 *= var0;
         }

         return var3;
      }
   }

   public static double b(double var0, int var2) {
      if (var2 > 13) {
         return var0;
      } else if (var2 > 0 && var2 != 1) {
         return com.aspose.cells.b.a.zq.a(com.aspose.cells.b.a.zq.b(var0, 13), var2, 1);
      } else {
         double var3 = Math.pow(10.0D, (double)var2);
         return var0 > 0.0D ? Math.floor(var0 * var3 + 0.5D) / var3 : Math.ceil(var0 * var3 - 0.5D) / var3;
      }
   }

   static Object a(Workbook var0, Object var1, Object var2, boolean var3) {
      if (var1 == null) {
         var1 = 0.0D;
      }

      if (var2 == null) {
         var2 = 0.0D;
      }

      if (!com.aspose.cells.a.c.zc.a(var1) && !com.aspose.cells.a.c.zc.a(var2)) {
         double var4 = 0.0D;
         double var6 = 0.0D;
         var1 = zyn.a(var1, var0.getSettings());
         if (var1 instanceof Double) {
            var4 = (Double)var1;
            var2 = zyn.a(var2, var0.getSettings());
            if (var2 instanceof Double) {
               var6 = (Double)var2;
               if (var3) {
                  return var4 + var6;
               } else if (a(var4, var6)) {
                  return 0.0D;
               } else {
                  double var8 = var4 - var6;
                  return var8;
               }
            } else {
               return var2;
            }
         } else {
            return var1;
         }
      } else {
         return zba.a(var0, var1, var2, var3);
      }
   }

   static Object a(Workbook var0, Object var1, Object var2) {
      if (var1 == null) {
         return 0.0D;
      } else if (var2 == null) {
         return 0.0D;
      } else if (var1 instanceof zst) {
         return var1;
      } else if (var2 instanceof zst) {
         return var2;
      } else {
         double var3 = 0.0D;
         double var5 = 0.0D;
         var1 = zyn.e(var1, var0.getSettings().getDate1904());
         if (var1 instanceof zst) {
            return var1;
         } else {
            var3 = (Double)var1;
            var2 = zyn.e(var2, var0.getSettings().getDate1904());
            if (var2 instanceof zst) {
               return var2;
            } else {
               var5 = (Double)var2;
               double var7 = var3 * var5;
               return var7;
            }
         }
      }
   }

   static Object b(Workbook var0, Object var1, Object var2) {
      var1 = zyn.e(var1, var0.getSettings().getDate1904());
      if (var1 instanceof zst) {
         return var1;
      } else {
         var2 = zyn.e(var2, var0.getSettings().getDate1904());
         if (var2 instanceof zst) {
            return var2;
         } else {
            double var3 = (Double)var1;
            double var5 = (Double)var2;
            return Math.abs(var5) < Double.MIN_VALUE ? zst.a : var3 / var5;
         }
      }
   }

   static Object c(Workbook var0, Object var1, Object var2) {
      if (var1 instanceof zst) {
         return var1;
      } else if (var2 instanceof zst) {
         return var2;
      } else {
         String var4;
         double var7;
         DateTime var9;
         switch(zamo.a(var1.getClass())) {
         case 3:
            return com.aspose.cells.b.a.zv.b(com.aspose.cells.b.a.zr.a(var1), com.aspose.cells.b.a.zr.a(var2));
         case 14:
            double var5 = (Double)var1;
            switch(zamo.a(var2.getClass())) {
            case 14:
               var7 = (Double)var2;
               if (var5 == (Double)var2) {
                  return true;
               }

               return false;
            case 15:
            case 17:
            default:
               return false;
            case 16:
               var7 = CellsHelper.getDoubleFromDateTime((DateTime)var2, var0.getSettings().getDate1904());
               if (var5 == var7) {
                  return true;
               }

               return false;
            case 18:
               var4 = (String)var2;
               if (zapb.d(var4)) {
                  var7 = com.aspose.cells.b.a.zn.a(var4);
                  if (var5 == var7) {
                     return true;
                  }

                  return false;
               } else {
                  try {
                     var9 = DateTime.a(var4);
                     var7 = CellsHelper.getDoubleFromDateTime(var9, var0.getSettings().getDate1904());
                     if (var5 == var7) {
                        return true;
                     }

                     return false;
                  } catch (Exception var12) {
                     return false;
                  }
               }
            }
         case 16:
            switch(zamo.a(var2.getClass())) {
            case 14:
               return c(var0, var2, var1);
            case 15:
            case 17:
            default:
               return false;
            case 16:
               if (DateTime.a((DateTime)var1, (DateTime)var2)) {
                  return true;
               }

               return false;
            case 18:
               var4 = (String)var2;
               if (zapb.d(var4)) {
                  var7 = com.aspose.cells.b.a.zn.a(var4);
                  return c((Workbook)var0, var1, (Object)var7);
               } else {
                  try {
                     var9 = DateTime.a(var4);
                     if (DateTime.a((DateTime)var1, var9)) {
                        return true;
                     }

                     return false;
                  } catch (Exception var11) {
                     return false;
                  }
               }
            }
         case 18:
            switch(zamo.a(var2.getClass())) {
            case 14:
            case 16:
               return c(var0, var2, var1);
            case 15:
            case 17:
            default:
               return false;
            case 18:
               String var3 = (String)var1;
               var4 = (String)var2;
               return com.aspose.cells.b.a.zv.b(var3, var4);
            }
         default:
            return false;
         }
      }
   }

   static Object a(Workbook var0, Object var1) {
      if (var1 == null) {
         return true;
      } else {
         double var2;
         switch(zamo.a(var1.getClass())) {
         case 3:
            return !(Boolean)var1;
         case 14:
            var2 = (Double)var1;
            if (var2 == 0.0D) {
               return true;
            }

            return false;
         case 16:
            var2 = CellsHelper.getDoubleFromDateTime((DateTime)var1, var0.getSettings().getDate1904());
            if (var2 == 0.0D) {
               return true;
            }

            return false;
         case 18:
            return zst.i;
         default:
            return zst.i;
         }
      }
   }

   static Object d(Workbook var0, Object var1, Object var2) {
      var1 = zyn.e(var1, var0.getSettings().getDate1904());
      if (var1 instanceof zst) {
         return var1;
      } else {
         var2 = zyn.e(var2, var0.getSettings().getDate1904());
         if (var2 instanceof zst) {
            return var2;
         } else {
            double var3 = (Double)var1;
            double var5 = (Double)var2;
            if (Math.abs(var3) < Double.MIN_VALUE) {
               if ((Double)var2 < 0.0D) {
                  return zst.a;
               }

               if (Math.abs(var5) < Double.MIN_VALUE) {
                  return zst.f;
               }
            }

            double var7 = 0.0D;
            if (var3 < 0.0D) {
               if (Math.abs(var5) < Double.MIN_VALUE) {
                  return 1.0D;
               }

               if (Math.abs(var5) < 1.0D) {
                  double var9 = 1.0D / var5;
                  if (var9 % 2.0D != 0.0D) {
                     var7 = -Math.pow(-var3, var5);
                     if (Double.isNaN(var7)) {
                        return zst.f;
                     }

                     return var7;
                  }

                  return zst.f;
               }
            }

            var7 = Math.pow((Double)var1, (Double)var2);
            return Double.isNaN(var7) ? zst.f : var7;
         }
      }
   }

   static Object a(Object var0, Object var1, Workbook var2) {
      var0 = zyn.e(var0, var2.getSettings().getDate1904());
      if (var0 instanceof Double) {
         double var3 = (Double)var0;
         var1 = zyn.e(var1, var2.getSettings().getDate1904());
         if (var1 instanceof Double) {
            int var5 = (int)com.aspose.cells.a.c.zi.b(var1);
            if (var5 < -308) {
               return zst.f;
            } else {
               double var6 = Math.pow(10.0D, (double)var5);
               var3 *= var6;
               if (var3 < 2.147483647E9D && var3 > -2.147483648E9D) {
                  int var8 = com.aspose.cells.b.a.zo.a((int)var3).length();
                  if (var8 < 15) {
                     var3 = com.aspose.cells.b.a.zq.b(var3, 15 - var8);
                  }
               }

               return var3 > 0.0D ? Math.floor(var3) / var6 : Math.ceil(var3) / var6;
            }
         } else {
            return var1;
         }
      } else {
         return var0;
      }
   }

   static Object b(Object var0, Object var1, Workbook var2) {
      var0 = zyn.e(var0, var2.getSettings().getDate1904());
      if (var0 instanceof Double) {
         double var3 = (Double)var0;
         var1 = zyn.e(var1, var2.getSettings().getDate1904());
         if (var1 instanceof Double) {
            int var5 = (int)com.aspose.cells.a.c.zi.b(var1);
            return b((Double)var0, var5);
         } else {
            return var1;
         }
      } else {
         return var0;
      }
   }

   static Object c(Object var0, Object var1, Workbook var2) {
      var0 = zyn.e(var0, var2.getSettings().getDate1904());
      if (var0 instanceof Double) {
         double var3 = (Double)var0;
         var1 = zyn.e(var1, var2.getSettings().getDate1904());
         if (var1 instanceof Double) {
            int var5 = (int)com.aspose.cells.a.c.zi.b(var1);
            if (var5 < -308) {
               return zst.f;
            } else {
               double var6 = Math.pow(10.0D, (double)var5);
               var3 *= var6;
               if (var3 < 2.147483647E9D && var3 > -2.147483648E9D) {
                  int var8 = com.aspose.cells.b.a.zo.a((int)var3).length();
                  if (var8 < 15) {
                     var3 = com.aspose.cells.b.a.zq.b(var3, 15 - var8);
                  }
               }

               return var3 > 0.0D ? Math.ceil(var3) / var6 : Math.floor(var3) / var6;
            }
         } else {
            return var1;
         }
      } else {
         return var0;
      }
   }

   static Object a(Object var0, Object var1, WorkbookSettings var2) {
      if (var1 == null) {
         return zst.a;
      } else if (var0 == null) {
         return 0.0D;
      } else {
         var0 = zyn.a(var0, var2);
         var1 = zyn.a(var1, var2);
         if (!(var0 instanceof Double)) {
            return var0;
         } else if (!(var1 instanceof Double)) {
            return var1;
         } else {
            double var3 = (Double)var0;
            double var5 = (Double)var1;
            if (Math.abs(var5) < Double.MIN_VALUE) {
               return zst.a;
            } else if (Math.abs(var3) < Double.MIN_VALUE) {
               return 0.0D;
            } else {
               double var7 = var3 % var5;
               if (Math.signum(var3) != Math.signum(var5)) {
                  var7 += var5;
               }

               return var7;
            }
         }
      }
   }
}
